<?php
/* @var $this yii\web\View */

use yii\helpers\Html;
use yii\helpers\Url;

$this->title = '分销中心';

$directoryAsset = $this->context->assetUrl;
?>
<div class="page__bd pyramid-mine">
    <div class="weui-panel__bd">
        <div class="weui-media-box weui-media-box_appmsg weui-media-box_text">
            <div class="weui-media-box__hd">
                <?=
                Html::img($identity->avatar ?: $directoryAsset . '/images/avatar.png', [
                    'class' => 'weui-media-box__thumb img-circle'
                ])
                ?>
            </div>
            <div class="weui-media-box__bd">
                <h4 class="weui-media-box__title font-white"><?= $identity->username ?></h4>
                <p class="weui-media-box__desc font-yellow">&lt;<?= $level['name'] ?>&gt;</p>
                <ul class="weui-media-box__info font-white">
                    <li class="weui-media-box__info__meta">推荐人: <?= $upper['username'] ?></li>
                    <?php if (isset($upper['level'])): ?>
                        <li class="weui-media-box__info__meta weui-media-box__info__meta_extra"><?= $upper['level'] ?></li>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
    </div>
    <?php if ($account): ?>
        <div class="weui-cells__title">历史提现佣金(元)</div>
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <h2><?= sprintf('%.2f', $account->withdraw / 100) ?></h2>
                </div>
            </div>
        </div>
        <div class="weui-cells__title">可提现佣金(元)</div>
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <p><?= sprintf('%.2f', $account->current / 100) ?></p>
                </div>
                <div class="weui-cell__ft">
                    <a class="weui-btn weui-btn_mini weui-btn_disabled">佣金提现</a>
                </div>
            </div>
        </div>
    <?php else: ?>
        <div class="weui-cells__title"><i class="ionicons ion-android-cancel font-yellow"></i> 您的账户存在异常，错误码:</div>
        <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <h2>E08M<?= $member->id ?>U<?= $identity->id ?></h2>
                </div>
                <div class="weui-cell__ft">
                    <a class="weui-btn weui-btn_mini weui-btn_disabled">联系客服</a>
                </div>
            </div>
        </div>
    <?php endif; ?>
</div>
<div class="weui-grids weui-grids-border">
    <a class="weui-grid" href="<?= Url::to(['/commission/brokerage']) ?>">
        <div class="weui-grid__icon">
            <?= Html::img($directoryAsset . '/images/icons/commission.png') ?>
        </div>
        <p class="weui-grid__label">
            分销佣金
        </p>
        <label class="text"><span><?= sprintf('%.2f', $account->current / 100) ?></span> 元</label>
    </a>
    <a class="weui-grid" href="<?= Url::to(['/commission/order']) ?>">
        <div class="weui-grid__icon">
            <?= Html::img($directoryAsset . '/images/icons/list.png') ?>
        </div>
        <p class="weui-grid__label">分销订单</p>
        <label class="text"><span>0</span> 笔</label>
    </a>
    <a class="weui-grid" href="<?= Url::to(['/commission/logs']) ?>">
        <div class="weui-grid__icon">
            <?= Html::img($directoryAsset . '/images/icons/withdraw.png') ?>
        </div>
        <p class="weui-grid__label">提现明细</p>
        <label class="text"><span>0</span> 笔</label>
    </a>
    <a class="weui-grid" href="<?= Url::to(['/commission/downer']) ?>">
        <div class="weui-grid__icon">
            <?= Html::img($directoryAsset . '/images/icons/group.png') ?>
        </div>
        <p class="weui-grid__label">我的关注</p>
        <label class="text"><span><?= $member->downersCount ?></span> 人</label>
    </a>
    <a class="weui-grid"><?php // Url::to(['/commission/rank'])  ?>
        <div class="weui-grid__icon">
            <?= Html::img($directoryAsset . '/images/icons/rank.png') ?>
        </div>
        <p class="weui-grid__label">佣金排名</p>
        <label class="text"></label>
    </a>
    <a class="weui-grid" href="<?= Url::to(['/commission/extend']) ?>">
        <div class="weui-grid__icon">
            <?= Html::img($directoryAsset . '/images/icons/qrcode.png') ?>
        </div>
        <p class="weui-grid__label">推广二维码</p>
        <label class="text"></label>
    </a>
</div>